#include <iostream>
#include <vector>
#include <algorithm>

//硬币选择，有1,3,5币值的硬币，如何凑够11，使所需要的硬币数量最小
//贪心实现
//输出最小硬币数量
int main()
{
    std::vector<int> coins = {1,3,5};
    int coin_num = 0;
    int amount = 10;
    std::sort(coins.begin(),coins.end(),[](int a,int b){
        return a > b;
    });
    auto iter = coins.begin();
    while(amount > 0)
    {
        if(amount >= *iter)
        {
            amount -= *iter;
            coin_num++;
        }
        else
        {
            iter++;
        }
    }
    std::cout << coin_num << std::endl;
}